
$(document).ready(function(){
	$( "#dialog" ).dialog({
		  autoOpen: false,
	      modal: true,
	      open: function(event, ui) { $(this).closest('.ui-dialog').find('.ui-dialog-titlebar-close').hide(); },
	      buttons: {
	        Ok: function() {
	          $( this ).dialog( "close" );
	          if ($('input[name="trang_thai_save"]').val() == 'true') {
	          	window.location.href = baseUrl + "quan_tri/san_pham/tra_cuu?ma_sp=" + $('input[name="ma_sp"]').val();
	          }
	        }
	      }
	    });
	if ($( "#dialog p" ).html() != "") {
		$( "#dialog" ).dialog("open");
	}
	$('button[name="new_copy"]').click(function(){
        var theForm = $('.themsp');
        theForm.attr('action',baseUrl + 'quan_tri/san_pham/them_moi/');
        theForm.submit();
    });
	
});
